package com.gaohe.dcp.service.impl;

import java.util.List;
import com.gaohe.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gaohe.dcp.mapper.DcpSchedulingMapper;
import com.gaohe.dcp.domain.DcpScheduling;
import com.gaohe.dcp.service.IDcpSchedulingService;

/**
 * 排班记录Service业务层处理
 *
 * @author ruoyi
 * @date 2025-04-23
 */
@Service
public class DcpSchedulingServiceImpl implements IDcpSchedulingService
{
    @Autowired
    private DcpSchedulingMapper dcpSchedulingMapper;

    /**
     * 查询排班记录
     *
     * @param schedulingId 排班记录主键
     * @return 排班记录
     */
    @Override
    public DcpScheduling selectDcpSchedulingBySchedulingId(Long schedulingId)
    {
        return dcpSchedulingMapper.selectDcpSchedulingBySchedulingId(schedulingId);
    }

    /**
     * 查询排班记录列表
     *
     * @param dcpScheduling 排班记录
     * @return 排班记录
     */
    @Override
    public List<DcpScheduling> selectDcpSchedulingList(DcpScheduling dcpScheduling)
    {
        return dcpSchedulingMapper.selectDcpSchedulingList(dcpScheduling);
    }

    /**
     * 新增排班记录
     *
     * @param dcpScheduling 排班记录
     * @return 结果
     */
    @Override
    public int insertDcpScheduling(DcpScheduling dcpScheduling)
    {
        dcpScheduling.setCreateTime(DateUtils.getNowDate());
        return dcpSchedulingMapper.insertDcpScheduling(dcpScheduling);
    }

    /**
     * 修改排班记录
     *
     * @param dcpScheduling 排班记录
     * @return 结果
     */
    @Override
    public int updateDcpScheduling(DcpScheduling dcpScheduling)
    {
        dcpScheduling.setUpdateTime(DateUtils.getNowDate());
        return dcpSchedulingMapper.updateDcpScheduling(dcpScheduling);
    }

    /**
     * 批量删除排班记录
     *
     * @param schedulingIds 需要删除的排班记录主键
     * @return 结果
     */
    @Override
    public int deleteDcpSchedulingBySchedulingIds(Long[] schedulingIds)
    {
        return dcpSchedulingMapper.deleteDcpSchedulingBySchedulingIds(schedulingIds);
    }

    /**
     * 删除排班记录信息
     *
     * @param schedulingId 排班记录主键
     * @return 结果
     */
    @Override
    public int deleteDcpSchedulingBySchedulingId(Long schedulingId)
    {
        return dcpSchedulingMapper.deleteDcpSchedulingBySchedulingId(schedulingId);
    }

    @Override
    public boolean checkUserInDept(Long userId, Long deptId) {
        return dcpSchedulingMapper.checkUserInDept(userId, deptId);
    }
}
